package thread.basic;

public class Demo08_Priority {
    public static void main(String[] args) {
        Thread t1 = new Thread("t1") {
            @Override
            public void run() {
                for (int i = 0; i < 1000; i++) {
                    System.out.println(getName());
                }
            }
        };

        Thread t2 = new Thread("t2") {
            @Override
            public void run() {
                for (int i = 0; i < 1000; i++) {
                    System.out.println(getName());
                }
            }
        };

        //t1.setPriority(); 线程默认优先级是5，最小是：1，最大是：10
        //没吊用

        t1.setPriority(Thread.MIN_PRIORITY);//设置最小的优先级
        t2.setPriority(Thread.MAX_PRIORITY);//设置最大的优先级

        t1.start();
        t2.start();
    }
}
